package cn.yunbamboos.mybatis.mapping.methods.dynamicQuery;

import cn.yunbamboos.mybatis.mapping.methods.BaseDynamicQueryMethod;
import cn.yunbamboos.mybatis.metadata.TableInfo;
import org.apache.ibatis.scripting.xmltags.StaticTextSqlNode;
import org.apache.ibatis.session.Configuration;

import java.util.Optional;

public class QueryForObject extends BaseDynamicQueryMethod {

    public QueryForObject(Configuration configuration, TableInfo tableInfo) {
        super("queryForObject", configuration, tableInfo);
    }

    @Override
    protected Optional<StaticTextSqlNode> getSortSqlNode() {
        return Optional.empty();
    }

    @Override
    protected Optional<StaticTextSqlNode> getLimitSqlNode() {
        return Optional.of(new StaticTextSqlNode(" limit 1"));
    }
}

